package com.example.jimanguang.Entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "Subsribecomic")
@Getter
@Setter
public class SubsribeComic extends  BaseEntity{
    public static final int TYPE_UNSUBSRIBED=0;
    public static final int TYPE_SUBSRIBED=1;

    private int  subsribe_status;
    @Temporal(TemporalType.TIMESTAMP)//确保实体类中的属性类型与数据库中的时间属性类型相匹配
    private Date substribe_time;//订阅时间

    public SubsribeComic() {
        this.substribe_time = new Date();
    }

    @ManyToOne
    private User user;
    @OneToOne
    private Comics comics;
    @JsonBackReference
    public User getUser(){return user;}

}
